﻿using Microsoft.EntityFrameworkCore;
using Sample.Novel.Domain.Authors.Entities;
using Sample.Novel.Domain.Books.Entites;
using Sample.Novel.Domain.Categories.Entities;
using System;
using System.Reflection;
using Volo.Abp.Data;
using Volo.Abp.EntityFrameworkCore;

namespace Sample.Novel.EntityFrameworkCore
{
    [ConnectionStringName("NovelDb")]
    public class NovelDbContext
        : AbpDbContext<NovelDbContext>
    {
        public DbSet<Author> Authors { get; set; }

        public DbSet<Category> Categories { get; set; }

        public DbSet<Book> Books { get; set; }

        public DbSet<Chapter> Chapters { get; set; }

        public DbSet<ChapterText> ChaptersText { get; set; }

        public NovelDbContext():base(null) { 
            
        }

        public NovelDbContext(DbContextOptions<NovelDbContext> options) : base(options) {
            
        }

        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {
            base.OnConfiguring(optionsBuilder);
        }

        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            base.OnModelCreating(modelBuilder);
            modelBuilder.ApplyConfigurationsFromAssembly(Assembly.GetExecutingAssembly());
        }
    }
}
